import java.util.Calendar;
import java.util.Scanner;

// HJ73 计算日期到天数转换
public class HJ73 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.nextLine();
            String[] s = str.split(" ");
            Integer year = Integer.parseInt(s[0]);
            Integer mon = Integer.parseInt(s[1]);
            Integer day = Integer.parseInt(s[2]);
            boolean flag = false;
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                flag = true;
            }
            int count = 0;
            for (int i = 1; i < mon; i++) {
                switch (i) {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        count += 31;
                        break;
                    case 2:
                        if (flag) {
                            count += 29;
                        } else {
                            count += 28;
                        }
                        break;
                    default:
                        count += 30;
                }
            }
            System.out.println(count + day);

            // -----------------------------
            Scanner in=new Scanner(System.in);
            int y=in.nextInt();
            int m=in.nextInt();
            int d=in.nextInt();
            Calendar c1=Calendar.getInstance();//实例化
            c1.set(y, m-1, d);//注意月份从0开始
            System.out.println(c1.get(Calendar.DAY_OF_YEAR));

        }
    }
}

